<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Visit &middot; California</title>

    <!-- CSS styles -->
    <link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="../css/popupuser.css" rel="stylesheet">
    <link href="../css/user.css" rel="stylesheet">
    <link href="../css/visitcali.css" rel="stylesheet">
    <link href="../bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
  </head>

    <body>
	<?php
    include("user_controller.php");
    ?>
      <div class="container">
       <div class="masthead">
        <h1 class="muted">VisitCali.com
		 <?php
	$user_id = 0;
	$isAdmin = true;
	 session_start();
	if (isset($_SESSION['email']))
	{
	  if (isset($_SESSION['admin'])) {
	     echo ('<a href="user.php"  style="margin:5px" class="btn btn-primary btn-medium pull-right">User Administration</a>');
	  }
	  echo ('<a href="../logout_user.php" style="margin:5px" class="btn btn-primary btn-medium pull-right">Sign-out</a><small style="margin:10px;font-size:0.5em"class="pull-right">'.$_SESSION['email'].'</small>');
	}
	else
	{	
		header('Location: http://cis444.cs.csusm.edu/group5/index.php') ;
	}
	?>
	</h1>
        <img src="../img/widescreenBanner1.jpg" alt="smiley face"/> 
        <div class="navbar">
          <div class="navbar-inner">
            <div class="container">
              <ul class="nav">
                <li><a href="../index.php">Home</a></li>
                <li><a href="places.php">Places to visit</a></li>
                <li><a href="dos-donts.php">Do's and don'ts</a></li>
                <li><a href="faq.php">FAQ</a></li>
                <li><a href="about.php">About us</a></li>
              </ul>
            </div>
          </div>
        </div>
      </div>

      <div class="jumbotron">
        <h1>User information</h1>
      </div>
		<?php
		// ASSUMING THAT THE ID OF THE REQUESTED USER is: 1
        echo (setUpUserInformation(getIDConnectedUser()));
		?>
		
    </div>

    <div class="topPadding50">
      <p class="titleDiv">Posted articles :</p>
      <table title="Articles list" class="table topPadding20">
        <caption></caption>
        <thead>
          <tr> 	
            <th>Locations</th>
            <th>Date/Time</th>
            <th>Action</th>
          </tr>
        </thead>
        <tbody>
          
		  <?php
		// ASSUMING THAT THE ID OF THE REQUESTED USER is: 1
        echo (setUpPostedArticlesFromUser(getIDConnectedUser()));
		?>

        </tbody>
      </table>
    </div>
    <button type="button" onclick="addNewArticle();" class="btn btn-primary btn-large" data-toggle="button">Add a place to visit &raquo;</button>
      <div class="container expendableDiv" id="idDivExpendable">
        <form>
          <fieldset>
            <legend>New place</legend>
            <label for="placelocation">Place location</label>
            <input id="placelocation" type="text" placeholder="Type something…">
            <label for="articlebody">Article</label>
            <textarea id="articlebody" rows="3" placeholder="Type something…"></textarea>
            <span class="help-block">Remember that the article you are writing mustn't contain some insults or shocking pictures. Please be respectful.</span>
          </fieldset>
        <!-- </form> -->

        <div class="browse">
          <!-- <form> -->
            <label id="labelUpload"for="imageUploadField">Upload</label>
            <input id="imageUploadField" type="file" class="input_text"/>
          
          <button class="btn btn-success"><i class="icon-plus-sign icon-white pictureInButton"></i> Upload</button>
        </div>

      </form>
        <div class="topPadding20">
          <img src="http://fakeimg.pl/190x160/" alt="previewupload1">
          <img src="http://fakeimg.pl/190x160/" alt="previewupload2">
          <img src="http://fakeimg.pl/190x160/" alt="previewupload2">
        </div>
		<?php
			echo (createSubmitButton(getIDConnectedUser()));
		?>
      </div>
      <hr>
      <div class="topPadding50">
        <p class="titleDiv">Posted comments :</p>
        <table title="Comments list" class="table topPadding20">
          <thead>
            <tr>
              <th>Comment</th>
              <th>Locations</th>
              <th>Date/Time</th>
              <th>Action</th>
            </tr>
          </thead>
          <tbody>
		   <?php
			echo (setUpPostedCommentFromUser(getIDConnectedUser()));
			?>
          </tbody>
        </table>
      </div>

      <hr>
		<div id="addNewPlace" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h3>Add a new place</h3>
          </div>
           <form action="add_new_place.php" method="post" enctype="multipart/form-data">
          <div class="modal-body">
            <input type="number" style="display: none" name="userId" value="1" />
            <input class="span2" type="text" name="title" placeholder="title" /><br />
            <input type="file" title="Image 1" name="file" id="file"><br><br />
            <input type="file" title="Image 2" name="img2" id="img2"><br><br />
            <textarea name="article" class="span5" rows="10"></textarea>
              <input class="btn" type="submit" name="submit" value="Submit" />
          </form>
          </div>
          <div class="modal-footer">
            <a href="#" data-dismiss="modal" aria-hidden="true" class="btn">Close</a>
          </div>
        </div>
      <div class="footer">
        <p>&copy; CSUSM 2013 [CIS 444]</p>
      </div>
    </div>

    <!-- ====================JAVASCRIPT============================ -->
    <!-- Placed at the end of the document so the pages load faster -->
	 <script type="text/javascript" src="../bootstrap/js/jquery.js"></script>
	<script src="http://www.jacklmoore.com/colorbox/jquery.colorbox.js"></script>
    <script type="text/javascript" src="../bootstrap/js/bootbox.js"></script>
    <script src="../bootstrap/js/bootstrap-transition.js"></script>
    <script src="../bootstrap/js/bootstrap-modal.js"></script>
    <script src="../bootstrap/js/bootstrap-file-input.js"></script>
	<script type="text/javascript" src="../js/user.js"></script>
    

    <!-- POP UP User Modification/Inscription -->
    <div id="popup1" class="popup_block">
      <div>
        <h2 class="centerInDiv">Inscription/Modification</h2>
      </div>
      <!-- <div class="container-fluid"> -->
        <div class="form-horizontal">
        <form>
<!--           <legend>Person Form</legend>
 -->          <div class="row-fluid">
            <!-- ERROR DIV FORM -->
            <div class="row-fluid invisible">
              <div class="span12 bgcolor">
                <div class="alert alert-error">
                  <a href="" class="close" data-dismiss="alert">×</a>
                  Error Messages.
                </div>
              </div>
            </div>
            <?php
				echo (setUpModificationPopUp(getIDConnectedUser()));
			?>
		<p id="errors"></p>			
      </form>                  
    </div>
<!--     <div class="span4">
    </div> -->
    <!-- </div> -->
  </div>
</body>
</html>
